Field of the Invention
The present invention relates to data storage devices with flash memory and flash memory control methods.
Description of the Related Art
Flash memory, a data storage medium, is common in today's data storage devices. A NAND flash is one common type of flash memory.
For example, flash memory is typically used in memory cards, USB flash devices, solid-state drives, and so on. In another application with multi-chip package technology, a NAND flash chip and a controller chip are combined in one package as an embedded multi-media card (e.g. eMMC).
The storage space of a flash memory generally provides a plurality of physical blocks, and each physical block includes a plurality of physical pages. To release storage space for reuse, an erase operation has to be performed on a block-by-block basis, to release space one block at a time. When updating data, the new data is written into a spare space rather than being overwritten onto old data, and the old data has to be invalidated. Thus, the storage space management of flash memory is more complex than other storage mediums. A controller designed especially for flash memory is therefore called for. Furthermore, due to the operational features of a flash memory, it is more difficult to manage the mapping information between the logical addresses at the host side and the physical addresses at the flash memory side.
For easy management of storage space of a flash memory, a control unit for a flash memory is generally designed to partially and dynamically maintain the physical-to-logical address mapping information between the host side and the flash memory on a random access memory (e.g. an SRAM) and then upload the mapping information from the random access memory to the flash memory for non-volatile storage. However, the mapping information temporarily stored in the random access memory may disappear due to an unexpected power-off event. How to restore the mapping information in the random access memory during a power recovery process is an important issue in the field.